var http = require('http');
var sockjs = require('sockjs');

var echo = sockjs.createServer();
echo.on('connection', function (conn) {
	conn.on('data', function (message) {
		console.log("## 接收到消息：", message)
		conn.write(message);
	});
	conn.on('close', function () {
		console.log("--- 结束会话")
	});
});

var server = http.createServer();
echo.installHandlers(server, { prefix: '/sockjs-node' });
server.listen(8080, '0.0.0.0');